<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title language="html:systemSite"></title>
    <link rel="stylesheet" type="text/css" href="/static/common/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/static/common/easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/common/easyui/themes/IconExtension.css">
    <link rel="stylesheet" href="/static/common/pnotify/pnotify.custom.min.css" media="all" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/admin.css">
    <link rel="stylesheet" href="/static/common/animate/animate.min.css">
</head>
<body>
    <form action="/intendant/site/editSystem" method="post">
        <div class="easyui-layout nomargin pg" style="padding:10px 0px 10px 10px;">
            <table id="hm-pgrid"></table>
        </div>
        <div id="hm_toolbar">
            <a id="btn" href="" class="easyui-linkbutton" iconCls="icon-arrow_refresh" plain="true" language="html:refreshCurrent"></a>
            <a id="btn" href="javascript:void(0)" onclick="hm.ajaxPgrid(systemFunc,this)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" language="html:ajaxEdit"></a>
        </div>
    </form>
</body>
<script type="text/javascript" src="/static/common/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/static/common/easyui/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/common/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/static/common/pnotify/pnotify.custom.min.js"></script>
<script type="text/javascript" src="/static/admin/js/language.js"></script>
<script type="text/javascript" src="/static/admin/js/global.js"></script>
<script>
var rows = [
    { "name": hm.language.cfgPort, "group": hm.language.cfgServer,"key":"port", "value": {{.port}},"remark":hm.language.cfgPortRemark,"editor":{"type":'validatebox',"options":{"required": true,"validType":['numericNoHeadZero','length[1,4]']}}},
    { "name": hm.language.cfgReadTimeout, "group": hm.language.cfgServer,"key":"readTimeout", "value": {{.readTimeout}},"remark":hm.language.cfgReadTimeoutRemark,"editor":{"type":'validatebox',"options":{"required": true,"validType":['numericNoHeadZero','length[1,5]']}}},
    { "name": hm.language.cfgWriteTimeout, "group": hm.language.cfgServer,"key":"writeTimeout", "value": {{.writeTimeout}},"remark":hm.language.cfgWriteTimeoutRemark,"editor":{"type":'validatebox',"options":{"required": true,"validType":['numericNoHeadZero','length[1,5]']}}},
    { "name": hm.language.cfgLanguage, "group": hm.language.cfgCookie,"key":'language', "value": {{.language}},"remark":hm.language.cfgLanguageRemark, "editor": {"type": 'combobox', "options": {"data":[{"value":"cn","text":hm.language.chinese},{"value":"en","text":hm.language.english}],editable:false,}}},
    { "name": hm.language.cfgTerminalLog, "group": hm.language.cfgCommon,"key":'terminalLog', "value": {{.terminalLog}},"remark":hm.language.cfgTerminalLogRemark, "editor": {"type": 'combobox', "options": {"data":[{"value":"on","text":"on"},{"value":"off","text":"off"}],editable:false,}}},
    { "name": hm.language.cfgSqlLog, "group": hm.language.cfgCommon,"key":'sqlLog', "value": {{.sqlLog}},"remark":hm.language.cfgSqlLogRemark, "editor": {"type": 'combobox', "options": {"data":[{"value":"on","text":"on"},{"value":"off","text":"off"}],editable:false,}}},
    { "name": hm.language.cfgAjaxPolling, "group": hm.language.cfgCommon,"key":'ajaxPolling', "value": {{.ajaxPolling}},"remark":hm.language.cfgAjaxPollingRemark, "editor": {"type":'validatebox',"options":{"required": true,"validType":['numericNoHeadZero','length[1,3]']}}},
];
$('#hm-pgrid').propertygrid({
    width: 'auto',
    height: 'auto',
    data: rows,
    showGroup: true,
    scrollbarSize: 0,
    columns: [[
            { field: 'name', title: hm.language.cfgName, resizable: true,width:70 },
            { field: 'value', title: hm.language.cfgValue, resizable: true,width:30 },
            { field: 'remark', title: hm.language.cfgRemark, resizable: true,width:100 },
    ]],
    groupFormatter: function(value, rows){
        return value + ' - <span style="color:#666">' + rows.length + hm.language.cfgRows+'</span>';
    }
});
function systemFunc(data){
    var failed = hm.language.editFailed ? hm.language.editFailed : "Edit failed!",
        success = hm.language.editSuccess ? hm.language.editSuccess : "Edit success!",
        unknownError = hm.language.unknownError ? hm.language.unknownError : "Unknow error!",
        noAuth = hm.language.noAuth ? hm.language.noAuth : "You have no authority",
        sqlTypeVali = hm.language.sqlTypeVali ? hm.language.sqlTypeVali : "The database type can only be sqlite3, mysql!",
        portVali = hm.language.portVali ? hm.language.portVali : "The port number must be 1-5 bits positive integers!",
        readTimeoutVali = hm.language.readTimeoutVali ? hm.language.readTimeoutVali : "The readTimeout must be 1-3 bits positive integers!",
        writeTimeoutVali = hm.language.writeTimeoutVali ? hm.language.writeTimeoutVali : "The writeTimeout must be 1-3 bits positive integers!",
        cfgLanguageVali = hm.language.cfgLanguageVali ? hm.language.cfgLanguageVali : "Default language only allows English and spaces,2-80 characters!";
    if (data.status == 4) {
        parent.hm.notice("error", hm.language.editFailed + data.info);
    } else if(data.status == 11){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 12){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 13){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 14){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 15){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 16){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 17){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 18){
        parent.hm.notice("warn", data.info);
    } else if (data.status == 66) {
        parent.hm.notice("error", hm.language.noAuth);
    } else if(data.status == 1){
        parent.hm.notice("success", hm.language.editSuccess);
        parent.hm.refreshTab();
    } else{
        parent.hm.notice("error", hm.language.unknownError);
    }
}
</script>
</html>
